package com.hoshiicloud.mallshop.feign.hystrix;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.mallshop.feign.ShopAuthFeignService;
import com.hoshiicloud.mallshop.feign.ShopMarketFeignService;
import com.hoshiicloud.market.entity.activities.Slideshow;
import com.hoshiicloud.market.entity.activities.param.SlideshowAddParam;
import com.hoshiicloud.market.entity.activities.param.SlideshowQueryParam;
import com.hoshiicloud.market.entity.activities.param.SlideshowUpdateParam;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * @author qry
 * @date 2019/9/12 11:52
 */
@Slf4j
public class ShopMarketFeignServiceFallback implements FallbackFactory<ShopMarketFeignService> {
    @Override
    public ShopMarketFeignService create(Throwable throwable) {
        return new ShopMarketFeignService(){
            @Override
            public Response<Boolean> saveSlideshow(SlideshowAddParam param) {
                return Response.failed("保存店铺轮播图失败"+throwable.getMessage());
            }

            @Override
            public Response<Slideshow> querySlideshowById(Long id) {
                return Response.failed("根据Id查询店铺轮播图失败"+throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateSlideshowById(SlideshowUpdateParam param) {
                return Response.failed("根据Id更新店铺轮播图失败"+throwable.getMessage());
            }

            @Override
            public Response<Page<Slideshow>> slidershowPage(SlideshowQueryParam param) {
                return Response.failed("分页查询店铺轮播图失败"+throwable.getMessage());
            }

            @Override
            public Response<Boolean> deletedSlideshowById(Long id) {
                return Response.failed("根据Id删除店铺轮播图信息失败"+throwable.getMessage());
            }

        };
    }
}
